﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using NBFModel;

using PWMIS.DataMap.Entity;

using PWMIS.DataProvider.Data;
using PWMIS.DataProvider.Adapter;

namespace NBFBLL
{
    public class TrackRemindBLL
    {
        NBFDAL.SqlMapDAL.TrackRemindDAL trdal = new NBFDAL.SqlMapDAL.TrackRemindDAL();
        
        /// <summary>
        /// 根据用户ID、起止日期获取该用户服务的历史记录
        /// </summary>
        /// <param name="userid">用户姓名</param>
        /// <param name="start">开始日期</param>
        /// <param name="end">结束日期</param>
        /// <returns>返回用户服务的历史记录</returns>
        public  DataTable GetHistoryByID(string userid, string start, string end,string productnumber)
        {
            return trdal.GetHistoryByID(userid, start, end, productnumber).Tables[0];
        }

        
        /// <summary>
        /// 修改提醒记录为已经阅读
        /// </summary>
        /// <param name="guid"></param>
        /// <returns></returns>
        public  bool UpdateIsRead(string guid)
        {
            if (guid != null && guid.Length > 0)
            {
                tb_zdgl_histroyTX htx = new tb_zdgl_histroyTX();
                htx.guid = guid;
                htx.IsRead = "0";
                int num =  EntityQuery<tb_zdgl_histroyTX>.Instance.Update(htx);
                if (num > 0) return true;
                return false;
                //try
                //{
                //    string sql = "Update tb_zdgl_histroyTX set IsRead=1 where guid='" + guid + "'";
                //    int num = conn.Update(sql);
                //    if (num > 0)
                //    {
                //        return true;
                //    }
                //}
                //catch (Exception ex) { config.Debug(ex.Message + ex.StackTrace, config.debugType.error); return false; }
            }
            return false;
        }

    }
}
